<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Read from BLOB/CLOB data.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.cubrid-lob2-new.html">cubrid_lob2_new</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.cubrid-lob2-seek64.html">cubrid_lob2_seek64</a></div>
 <div class="up"><a href="ref.cubrid.html">CUBRID 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.cubrid-lob2-read" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">cubrid_lob2_read</h1>
  <p class="verinfo">(PECL CUBRID &gt;= 8.4.1)</p><p class="refpurpose"><span class="refname">cubrid_lob2_read</span> &mdash; <span class="dc-title">Read from BLOB/CLOB data.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.cubrid-lob2-read-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>cubrid_lob2_read</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$lob_identifier</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$len</code></span>
   )</div>

  <p class="para rdfs-comment">
   The <span class="function"><strong>cubrid_lob2_read()</strong></span> function reads <em><code class="parameter">len</code></em> bytes from the 
   LOB data and returns the bytes read.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.cubrid-lob2-read-parameters">
 <h3 class="title">参数</h3>
 <p class="para">
  <dl>

   
    <dt>
<em><code class="parameter">lob_identifier</code></em></dt>

    <dd>

     <p class="para">Lob identifier as a result of <span class="function"><a href="function.cubrid-lob2-new.html" class="function">cubrid_lob2_new()</a></span> or get from the result set.</p>
    </dd>

   
   
    <dt>
<em><code class="parameter">len</code></em></dt>

    <dd>

     <p class="para">Length from buffer you want to read from the lob data.</p>
    </dd>

   
  </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.cubrid-lob2-read-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
    Returns the contents as a string.
  </p>
  <p class="para">
    <strong><code>FALSE</code></strong> when there is no more data.
  </p>
  <p class="para">
    NULL on failure.
  </p>
  <p class="para">
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.cubrid-lob2-read-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1011">
   <p><strong>Example #1 <span class="function"><strong>cubrid_lob2_read()</strong></span> example 1</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;test_lob&nbsp;(id&nbsp;INT,&nbsp;contents&nbsp;CLOB)<br /><br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"public"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$req&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"select&nbsp;*&nbsp;from&nbsp;test_lob"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_LOB</span><span style="color: #007700">);<br /><br />print&nbsp;</span><span style="color: #DD0000">"position&nbsp;now&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">cubrid_lob2_tell</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">cubrid_lob2_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_CURSOR_FIRST</span><span style="color: #007700">);<br /><br />print&nbsp;</span><span style="color: #DD0000">"\nposition&nbsp;after&nbsp;moving&nbsp;farword&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">cubrid_lob2_tell</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_lob2_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">12</span><span style="color: #007700">);<br /><br />print&nbsp;</span><span style="color: #DD0000">"\nposition&nbsp;after&nbsp;reading&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">cubrid_lob2_tell</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />print&nbsp;</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">cubrid_lob2_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_CURSOR_CURRENT</span><span style="color: #007700">);<br /><br />print&nbsp;</span><span style="color: #DD0000">"\nposition&nbsp;after&nbsp;moving&nbsp;again&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">cubrid_lob2_tell</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_lob2_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">);<br />print&nbsp;</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
  
  <div class="example" id="example-1012">
   <p><strong>Example #2 <span class="function"><strong>cubrid_lob2_read()</strong></span> example 2</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;test_lob&nbsp;(id&nbsp;INT,&nbsp;contents&nbsp;CLOB)<br /><br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"dba"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$req&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"select&nbsp;*&nbsp;from&nbsp;test_lob"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$row&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_fetch_row</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">CUBRID_LOB</span><span style="color: #007700">);<br /><br />while&nbsp;(</span><span style="color: #0000BB">true</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_lob2_read</span><span style="color: #007700">(</span><span style="color: #0000BB">$row</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">1024</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;elseif&nbsp;(</span><span style="color: #0000BB">$data&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">false</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"There&nbsp;is&nbsp;no&nbsp;more&nbsp;data\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #DD0000">"There&nbsp;must&nbsp;some&nbsp;errors\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.cubrid-lob2-read-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.cubrid-lob2-write.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_write()</a> - Write to a lob object.</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-seek.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_seek()</a> - Move the cursor of a lob object.</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-seek64.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_seek64()</a> - Move the cursor of a lob object.</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-tell.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_tell()</a> - Tell the cursor position of the LOB object.</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-tell64.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_tell64()</a> - Tell the cursor position of the LOB object.</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-size.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_size()</a> - Get a lob object's size.</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-size64.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_size64()</a> - Get a lob object's size.</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.cubrid-lob2-new.html">cubrid_lob2_new</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.cubrid-lob2-seek64.html">cubrid_lob2_seek64</a></div>
 <div class="up"><a href="ref.cubrid.html">CUBRID 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
